#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
/*
 * Zenlayer.com Inc.
 * Copyright (c) 2014-2020 All Rights Reserved.
 */
package ${package}.${artifactId}.utils;

import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author yangshen
 * @version ${symbol_dollar} Id: StringUtils.java, v 0.1  yangshen Exp ${symbol_dollar}
 * @date 2020-04-26 17:05:09
 */
public class PcStringUtils {

    private static final Pattern UNDERLINE_PATTERN = Pattern.compile("_([a-z])");

    public static String camel(String str) {
        //正则匹配下划线及后一个字符，删除下划线并将匹配的字符转成大写
        str = str.substring(0, 1).toUpperCase() + str.substring(1);
        Matcher matcher = UNDERLINE_PATTERN.matcher(str);
        StringBuffer sb = new StringBuffer(str);
        if (matcher.find()) {
            sb = new StringBuffer();
            //将当前匹配的子串替换成指定字符串，并且将替换后的子串及之前到上次匹配的子串之后的字符串添加到StringBuffer对象中
            //正则之前的字符和被替换的字符
            matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
            //把之后的字符串也添加到StringBuffer对象中
            matcher.appendTail(sb);
        } else {
            return sb.toString();
        }
        return camel(sb.toString());
    }

    /**
     * 判断对象是否为空
     **/
    public static boolean isEmpty(@Nullable Object... objs) {
        for (Object obj : objs) {
            if (ObjectUtils.isEmpty(obj)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 有一个不为null返回true
     *
     * @param objs
     * @return
     */
    public static boolean isNotEmpty(@Nullable Object... objs) {
        for (Object obj : objs) {
            if (!ObjectUtils.isEmpty(obj)) {
                return false;
            }
        }
        return true;
    }

    /**
     * 存在一个不为空既返回true
     *
     * @param objs
     * @return
     */
    public static boolean isNotEmptyExist(@Nullable Object... objs) {
        for (Object obj : objs) {
            if (!ObjectUtils.isEmpty(obj)) {
                return true;
            }
        }
        return false;
    }

    public static Class getclass(String className) throws ClassNotFoundException//className是类名
    {
        return Class.forName(className);
    }

}
